package com.wuhongyu.service.impl;

import com.wuhongyu.base.BaseServiceImpl;
import com.wuhongyu.entity.Customer;
import com.wuhongyu.entity.Orders;
import com.wuhongyu.repository.CustomerDao;
import com.wuhongyu.repository.OrdersDao;
import com.wuhongyu.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("ordersService")
public class OrdersServiceImpl extends BaseServiceImpl<Orders> implements OrdersService {

    @Autowired
    private CustomerDao customerDao;
    private OrdersDao ordersDao;
    @Resource
    public void setDao(OrdersDao ordersDao){
        super.setBaseDao(ordersDao);
        this.ordersDao = ordersDao;
    }

    @Override
    public List<Orders> findAll(Integer customerid){
        return ordersDao.findByCustomerEqualsOrderByCreatetime(customerDao.getOne(customerid));
    }
}